package com.zjdiepu.www.commpent.mapper.yw;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.stereotype.Component;

import com.zjdiepu.www.base.core.BaseMapper;
import com.zjdiepu.www.base.enums.type.DataDicType;
import com.zjdiepu.www.commpent.RedisObjectClient;
import com.zjdiepu.www.ibiz.cache.ICachedDictionaryService;
import com.zjdiepu.www.ibiz.system.IBaseSysParamsService;
import com.zjdiepu.www.model.base.dto.SimpleDataDictionary;
import com.zjdiepu.www.model.icbc.dto.YwOpenCardHzicbcSub;
/**
 * 项目名称：dpqc-parent-manager-information <br/> 
 * 类名称：YwBusinessMapper <br/>  
 * 类描述：字段转换 <br/>    
 * 创建人：xiongxiaotun <br/> 
 * 创建时间：2017年4月25日 下午5:51:41  <br/>   
 * 修改人：xiongxiaotun <br/> 
 * 修改时间：2017年4月25日 下午5:51:41   <br/>  
 * 修改备注：    <br/> 
 * @version V1.0   <br/>
 */
@Component
public class YwOpenCardHzicbcVoMapper extends BaseMapper<YwOpenCardHzicbcSub>{
	@Resource
	private ICachedDictionaryService cachedDictionaryService;
	@Autowired
	private IBaseSysParamsService baseSysParamsService;
	@Autowired
	private RedisObjectClient redisObjectClient;

	@Override
	public void mapper(RedisConnection redisConnection,YwOpenCardHzicbcSub m) {
		if(null == m) {
			return;
		}
		String drawmode = m.getDrawmode();
		SimpleDataDictionary drawmodeDic = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), drawmode, DataDicType.HZICBC_DRAW_MODE.getCode());
		m.setDrawmodeDisplay(drawmodeDic == null ? "" : drawmodeDic.getName());
		
		
		String accgetm = m.getAccgetm();
		SimpleDataDictionary accgetmDic = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), accgetm, DataDicType.HZICBC_ACC_GETM.getCode());
		m.setAccgetmDisplay(accgetmDic == null ? "" : accgetmDic.getName());
		
		String emladdrf = m.getEmladdrf();
		SimpleDataDictionary emladdrfDic = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), emladdrf, DataDicType.HZICBC_EML_ADDRF.getCode());
		m.setEmladdrfDisplay(emladdrfDic == null ? "" : emladdrfDic.getName());
		
		String machgf = m.getMachgf();
		SimpleDataDictionary machgfDic = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), machgf, DataDicType.HZICBC_MACHGF.getCode());
		m.setMachgfDisplay(machgfDic == null ? "" : machgfDic.getName());
		
		String mrtlstat = m.getMrtlstat();
		SimpleDataDictionary mrtlstatDic = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), mrtlstat, DataDicType.HZICBC_MRTL_STAT.getCode());
		m.setMrtlstatDisplay(mrtlstatDic == null ? "" : mrtlstatDic.getName());
		
		String edulvl=m.getEdulvl();
		SimpleDataDictionary edulvlDic = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), edulvl, DataDicType.HZICBC_EDU_LVL.getCode());
		m.setEdulvlDisplay(edulvlDic == null ? "" : edulvlDic.getName());
		
		String homestat=m.getHomestat();
		SimpleDataDictionary homestatDic = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), homestat, DataDicType.HZICBC_HOME_STAT.getCode());
		m.setHomestatDisplay(homestatDic == null ? "" : homestatDic.getName());
		
		String modelcode=m.getModelcode();
		SimpleDataDictionary modelcodeDic = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), modelcode, DataDicType.HZICBC_MODEL_CODE.getCode());
		m.setModelcodeDisplay(modelcodeDic == null ? "" : modelcodeDic.getName());
		
//		String reltsex1=m.getReltsex1();
//		SimpleDataDictionary reltsex1Dic = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), reltsex1, DataDicType.HZICBC_re.getCode());
//		m.setReltsex1Display(reltsex1Dic == null ? "" : reltsex1Dic.getName());
//		
//		String reltsex2=m.getReltsex2();
//		SimpleDataDictionary reltsex2Dic = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), reltsex2, DataDicType.HZICBC_DRAW_MODE.getCode());
//		m.setReltsex2Display(reltsex2Dic == null ? "" : reltsex2Dic.getName());
	}
}
